package com.pet.client.system;

import com.pet.framework.page.ATTPage;
import com.pet.framework.page.Page;
import com.pet.framework.page.PagerFactory;
import com.pet.framework.util.BaseAction;
import com.pet.server.bo.common.TaskService;
import com.pet.server.po.PetSay;
import com.pet.server.po.TaskInfo;
import com.pet.system.constants.ATTSystem;

public class TaskAction extends BaseAction {
	
	private TaskService taskService;
	private TaskInfo task;
	private Integer id;
	
	
	/**
	 * 删除任务数据
	 * @return
	 */
	public String deleteTaskInfo(){
		TaskInfo v = taskService.getObject(id, TaskInfo.class);
		if(null!=v){
			v.setState(ATTSystem.DEV);
			taskService.updateObject(v);
		}
		return SUCCESS;
	}
	
	public String searchTaskInfo(){
		Page page = PagerFactory.createPage();
		taskService.searchTaskInfo(page, task);
		setAttr(ATTPage.PAGE_LIST, page);
		return SUCCESS;
	}

	public String toTask(){
		setAttr("task", taskService.getObject(id, TaskInfo.class));
		return SUCCESS;
	}
	public String suTask(){
		TaskInfo t = taskService.getObject(id, TaskInfo.class);
		if(null==t){
			taskService.saveTaskInfo(task);
		}else{
			taskService.updateTaskInfo(task,t);
		}
		return SUCCESS;
	}
	public TaskService getTaskService() {
		return taskService;
	}

	public void setTaskService(TaskService taskService) {
		this.taskService = taskService;
	}

	public TaskInfo getTask() {
		return task;
	}

	public void setTask(TaskInfo task) {
		this.task = task;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	
	
}
